<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/conn.asp"-->
<!--#include file="lib/saferequest.asp"-->
<!DOCTYPE HTML>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<link rel="stylesheet" href="lib/sheet.css" type="text/css" />
<link type="text/css" rel="stylesheet" href="lib/ui/themes/base/ui.all.css" />
<!-- jquery和ui -->
<script type="text/javascript" src="lib/jquery.js"></script>
<script type="text/javascript">
	$(function() {
		$(".contable").addClass("ct");	//载入table样式
		$(".contable th").addClass("ch").css("background-color","silver");	//载入th样式
		$(".contable td").addClass("ld");	//载入td样式
	});
</script>
</head>
<%
call CheckRights(2,2)

if request.QueryString("id")<>"" then id=SafeRequest("id",1) Else response.end
set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from (( select * from  yb where id="&id&" ) as yb LEFT JOIN cl ON yb.cyr = cl.clid)  left join freight on yb.yb_freight=freight.freight_id"
rs.open sql,conn,1,1
If rs.eof Then
	response.write("货单不存在！")
	response.end
End If
%>
<body>
<table class="contable">
	<thead>
		<tr>
			<th colspan="4" class="lh"><font size="4">基本信息</font>(录入时间:<%=rs("lrsj")%>&nbsp;下单人:<%=rs("xdr")%>)</th>
		</tr>
	</thead>
  <tr>
    <th>序号</th>
    <td><%=rs("id")%></td>
    <th>货单日期</th>
    <td><%=rs("rq")%></td>
  </tr>
  <tr>
    <th>详细厂名</th>
    <td colspan="4"><%=rs("client")%></td>
	</tr>
	<tr>
    <th>联系方式</th>
    <td colspan="4"><%=rs("contacts")%></td>
  </tr>
	<tr>
    <th>业务员</th>
    <td colspan="4"><%=rs("hz")%></td>
  </tr>
  <tr>
    <th>托运人</th>
    <td><%=rs("freight_name")%></td>
    <th>承运人</th>
    <td><%=rs("cph")%>(<%=rs("tel")%>)</td>
  </tr>
  <tr>
    <th>地点</th>
    <td><%=rs("dd")%></td>
		<th>时间</th>
		<td><%If IsDate(rs("sj")) Then response.write(formatdatetime(rs("sj"),4))%></td>
	</tr>
	<tr>
    <th>船名/航次</th>
    <td><%=rs("cmhc")%></td>
		<th>下单日期</th>
		<td><%=rs("xdrq")%></td>
  </tr>
  <tr>
    <th>提单号</th>
    <td><%=rs("tdh")%></td>
    <th>箱型</th>
    <td><%=rs("xx")%></td>
  </tr>
  <tr>
    <th>箱号</th>
    <td><%=rs("xh")%></td>
    <th>封号</th>
    <td><%=rs("fh")%></td>
  </tr>
	<thead>
		<tr>
			<th colspan="4" class="lh"><font size="4">基本费用</font></th>
		</tr>
	</thead>
  <tr>
    <th>提箱</th>
    <td><%=rs("tx")%></td>
    <th>还箱</th>
    <td><%=rs("hx")%></td>
  </tr>
  <tr>
    <th>应付运费</th>
    <td><%=rs("jsj")%></td>
    <th>堆存费</th>
    <td><%=rs("dcf")%></td>
  </tr>
  <tr>
    <th>垫资</th>
    <td><%=rs("dz")%></td>
    <th>管理成本</th>
    <td><%
														if rs("jsj")<>"" or rs("jsj")<>0 or rs("jgf")<>"" or rs("jgf")<>0 then 
															if rs("jsj")="" or isnull(rs("jsj")) then jsj0=0 else jsj0=rs("jsj")
															if rs("jgf")="" or isnull(rs("jgf")) then jgf0=0 else jgf0=rs("jgf")
															response.write(formatnumber((jsj0+jgf0)*0.1,2,-1))
														end if
												%></td>
  </tr>
  <tr>
    <th>注意事项</th>
    <td colspan="3"><%=rs("attentions")%></td>
  </tr>
  <tr>
    <th>车队备注</th>
    <td colspan="3"><%=rs("bz")%></td>
  </tr>
</table>
<p>最后更改人:<%=rs("gxry")%>&nbsp;最后更新时间:<%=rs("gxsj")%></p>
<br />
<p>
操作>> | <a href="edit_cd1.asp?id=<%=id%>">货单编辑</a> |
</p>
<br />
<table class="contable">
	<thead>
		<tr>
			<th>货单</th>
			<th>日期</th>
			<th>时间</th>
			<th>地点</th>
			<th>箱型</th>
			<th>派单时间</th>
			<th>接单时间</th>
			<th>提箱时间</th>
			<th>到厂时间</th>
			<th>离场时间</th>
			<th>进港时间</th>
		</tr>
	</thead>
	<tbody>
<%
set rs_progress = Server.CreateObject("ADODB.Recordset")
sql="select progress_yb,rq,sj,dd,xx,progress_start,progress_accept,progress_tx,progress_reach,progress_left,progress_arrival from (select * from progress  where progress_cl="&rs("cyr")&" and progress_start>(date()-1)) as p left join yb on p.progress_yb=yb.id order by p.progress_start desc"
'response.write sql
'response.end
rs_progress.open sql,conn,1,1
do while not rs_progress.eof
%>
		<tr <%if rs_progress("progress_yb")=clng(id) then response.write("style='background-color:red'")%>>
			<td><%=rs_progress("progress_yb")%></td>
			<td><%if isdate(rs_progress("rq")) then response.write(shortdate(rs_progress("rq")))%></td>
			<td><%if isdate(rs_progress("sj")) then response.write(formatdatetime(rs_progress("sj"),4))%></td>
			<td><%=rs_progress("dd")%></td>
			<td><%=rs_progress("xx")%></td>
			<td><%=rs_progress("progress_start")%></td>
			<td><%=rs_progress("progress_accept")%></td>
			<td><%=rs_progress("progress_tx")%></td>
			<td><%=rs_progress("progress_reach")%></td>
			<td><%=rs_progress("progress_left")%></td>
			<td><%=rs_progress("progress_arrival")%></td>
		</tr>
<%
	rs_progress.movenext
loop
rs_progress.close
Set rs_progress=Nothing

%>
	</tbody>
</table>
</body>
<%
rs.close
Set rs=Nothing
conn.close
Set conn=nothing
%>
</html>
